public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode(int x) { val = x; }
}

class Solution {
    //解法1：递归
    public TreeNode mirrorTree(TreeNode root) {
        if (root == null) return null;
        TreeNode leftTree = mirrorTree(root.left);
        root.left = mirrorTree(root.right);
        root.right = leftTree;
        return root;
        //一行大法
        //return root == null ? null : new TreeNode(root.val, mirrorTree(root.right), mirrorTree(root.left));
    }
    //解法2：迭代 未完待续
}